package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


    /**
     * @param ids:
     * @return List<Long>
     * @description 根据菜品id查询对应的套餐id
     */
    List<Long> getSetmealIdsByDishIds(List<Long> ids);

    /**
     * @param setmealDishes:
     * @return void
     * @description 向套餐菜品表插入n条数据
     */
    void insertBatchDishes(List<SetmealDish> setmealDishes);


    /**
     * @param setmealId:
     * @return void
     * @description 根据套餐id删除套餐菜品关联表数据
     */
    @Delete("delete from setmeal_dish  where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * @param setmealId:
     * @return List<SetmealDish>
     * @description 根据套餐id查询菜品数据
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getDishBySetmealId(Long setmealId);
}
